﻿using DAL;
using Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public class Userinfomanager
    {
        public Userinfo Checklogin(string username, string userpwd)
        {
            Userinfoservice server = new Userinfoservice();
            DataSet ds = server.Checklogin(username, userpwd);
            if (ds.Tables[0].Rows.Count>0)
            {
                Userinfo user = new Userinfo();
                user.name = ds.Tables[0].Rows[0]["Name"].ToString();
                user.password = ds.Tables[0].Rows[0]["Password"].ToString();
                user.type= ds.Tables[0].Rows[0]["type"].ToString();
                return user;
            }
            else { 
                return null;
            }
        }
    }
}
